<div class="main f_r">
    <div class='tabs'>
		<div class="uc_title m_10 tabs_menu">
			<label class="current node"><span>发票管理</span></label>
		</div>
	    <div class='tabs_content'>
	        <div id="address_list" class="form_content m_10 node">
	            <table class="list_table" width="100%" cellpadding="0" cellspacing="0">
	            	<colgroup>
	                	<col width="180px" />
		                <col width="160px" />
		                <col width="100px" />
		                <col />
	            	</colgroup>

	                <thead>
	                	<tr>
	                		<th>单位名称</th>
	                		<th>纳税人识别码</th>
	                		<th>发票类型</th>
	                		<th>操作</th>
	                	</tr>
	                </thead>
	                <tbody>
	                {foreach:items=Api::run("getInvoiceListByUserId")}
	                    <tr>
	                        <td>{$item['company_name']}</td>
	                        <td>{$item['taxcode']}</td>
	                        <td>{echo:CountSum::invoiceTypeText($item['type'])}</td>
	                        <td>
	                        	<a class="blue" href="javascript:void(0)" onclick='edit({$item['id']})'>修改</a>|
	                        	<a class="blue" href="javascript:void(0)" onclick="delModel({link:'{url:/ucenter/invoice_del/id/$item[id]}'});">删除</a>
	                        </td>
	                    </tr>
	                {/foreach}
	                </tbody>

	                <tfoot>
	                	<tr>
	                		<td colspan="3" class="t_l">
	                			<label class="btn_gray_s"><input type="button" value="新增发票" onclick="edit();" /></label>
	                		</td>
	                	</tr>
	                </tfoot>
	            </table>
	        </div>
	    </div>
    </div>
</div>

<script type='text/javascript'>
function edit(taxId)
{
	art.dialog.open(creatUrl("block/invoice/id/"+taxId),
	{
		"id":"taxWindow",
		"title":"发票编辑",
		"ok":function(iframeWin, topWin){
			var formObject = iframeWin.document.forms[0];
			if(formObject.onsubmit() === false)
			{
				alert("请正确填写各项信息");
				return false;
			}
			$.getJSON(formObject.action,$(formObject).serialize(),function(content){
				if(content.result == false)
				{
					alert(content.msg);
					return;
				}
				window.location.reload();
			});
			return false;
		},
		"okVal":"提交",
		"cancel":true,
		"cancelVal":"取消",
	});
}
</script>